/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package ru.rakev.matcher.builder;

import ru.rakev.matcher.factory.ProducerMatcherAdapterFactory;
import ru.rakev.matcher.Matcher;
import ru.rakev.matcher.factory.MatcherDecoratorFactory;
import ru.rakev.matcher.factory.MatcherFactory;
import ru.rakev.producer.builder.CompositeProducerBuilder;

/**
 *
 * @author Rakev
 */
public abstract class AdapterMatcherBuilder<F, C> {

    private CompositeProducerBuilder<F, C> producerBuilder;

    public AdapterMatcherBuilder(CompositeProducerBuilder<F, C> producerBuilder) {
        this.producerBuilder = producerBuilder;
    }

    public Matcher<F> build(Matcher<C> matcher) {
        return getProducerMatcherAdapterFactory().create(getProducerBuilder().build(), matcher);
    }

    protected CompositeProducerBuilder<F, C> getProducerBuilder() {
        return producerBuilder;
    }

    protected ProducerMatcherAdapterFactory getProducerMatcherAdapterFactory() {
        return ProducerMatcherAdapterFactory.create();
    }

    protected MatcherDecoratorFactory getMatcherDecoratorFactory() {
        return MatcherDecoratorFactory.create();
    }

    protected MatcherFactory getMatcherFactory() {
        return MatcherFactory.create();
    }
}
